$(function () {
    loadFoot(0);
    share();
    var myLoading=new MyToast('.loadingToast',{content:'正在提交...'});
    $('#submit').on('click',function(){
        var username=$('input[name=username]').val();
        var phone=$('input[name=phone]').val();
        var addr=$('input[name=addr]').val();
        var proportion=$('input[name=proportion]').val();
        var style=$('input[name=style]').val();
        var schedule=$('input[name=schedule]').val();
        if(!username||!phone||!addr){
            alert('姓名，电话，地址都是必填项！')
        }else {
            myLoading.show();
            $.ajax({
                url:host+'/CMSAPI/registerUserCRM',
                type:'POST',
                data:{
                    openid:openid,
                    cid:cid,
                    username:username,
                    addr:addr,
                    proportion:proportion,
                    style:style,
                    schedule:schedule,
                    Phone:phone
                },
                success:function(data){
                    if(data.state){
                        alert('报备客户成功！');
                        self.location=document.referrer;
                    }
                }
            })
        }
    })
});
